var sqlMap = {
  goods: {
    //全部商品
    select:
      // "SELECT * FROM goods g join image i on g.image_id=i.image_id join type t on g.type_id=t.type_id LEFT JOIN parameter p on g.parameter_id=p.id",
      "SELECT * FROM goods g join image i on g.image_id=i.image_id join type t on g.type_id=t.type_id",
    selectNum: "select count(*) Goods_Count from goods where goods_name=?",
    classify: "select * from type",
    categorySearch:
      "SELECT SQL_CALC_FOUND_ROWS * FROM goods g JOIN type t on g.type_id=t.type_id where t.type_id=?;",
    total:
      "SELECT count(*) as count FROM goods g JOIN type t on g.type_id=t.type_id where t.type_id=?"
  },
  cart: {
    //加入购物车
    add:
      "insert into cart (cart_name, cart_img, cart_price,cart_num,goods_id,id) values (?,?,?,?,?,?)",
    //商品的详细信息
    select: "select * from cart where id=?",
    //删除购物车
    delete: "delete from cart",
    //根据商品名查询
    selGoodsName: "select * from cart",
    //如果购物车已有该商品，则购物车数量+1
    update: "update cart set cart_num=? where cart_name=?"
  },
  user: {
    select: "select * from user",
    login: "select * from user where username=? and password=?",
    register: "insert into user (username,password) values(?,?)"
  },
  collect: {
    add:
      "insert into collect (collect_name, collect_img, collect_price,collect_discount,goods_id,id) values (?,?,?,?,?,?)",
    select: "SELECT * from collect",
    delete: "delete from collect"
  },
  address: {
    select: "select * from confirmaddress",
    delete: "delete from confirmaddress",
    insert:
      "insert into confirmaddress (confirmaddress_name,confirmaddress_tel,confirmaddress_address,id) values(?,?,?,?)"
  },
  order: {
    add:
      "insert into orders (order_no,order_img,order_name,order_price,order_num,goods_id,confirmAddress_id,id) values (?,?,?,?,?,?,?,?)",
    select: "select * from orders where id=?",
    delete: "delete from orders"
  }
};

module.exports = sqlMap;
